package org.rency.ues.response;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

@XmlType(namespace = "http://response.facade.ues.rency.org")
@XmlAccessorType(XmlAccessType.FIELD)
public class UesResponse {

	private boolean isSuccess;
	private String returnMessage;
	private String data;
	private String ticket;
	
	public static UesResponse success(String data,String ticket){
		UesResponse resp = new UesResponse();
		resp.setSuccess(true);
		resp.setData(data);
		resp.setTicket(ticket);
		return resp;
	}
	
	public static UesResponse success(String data,String ticket, String returnMessage){
		UesResponse resp = new UesResponse();
		resp.setSuccess(true);
		resp.setData(data);
		resp.setTicket(ticket);
		resp.setReturnMessage(returnMessage);
		return resp;
	}
	
	public static UesResponse fail(String data,String returnMessage){
		UesResponse resp = new UesResponse();
		resp.setSuccess(false);
		resp.setData(data);
		resp.setReturnMessage(returnMessage);
		return resp;
	}
	
	public boolean isSuccess() {
		return isSuccess;
	}
	public void setSuccess(boolean isSuccess) {
		this.isSuccess = isSuccess;
	}
	public String getReturnMessage() {
		return returnMessage;
	}
	public void setReturnMessage(String returnMessage) {
		this.returnMessage = returnMessage;
	}
	public String getData() {
		return data;
	}
	public void setData(String data) {
		this.data = data;
	}
	
	public String getTicket() {
		return ticket;
	}
	public void setTicket(String ticket) {
		this.ticket = ticket;
	}
	@Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }
	
}